﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Wicresoft.SMS.Data;
using System.Configuration;

using System.Web.Mvc;
using Ninject.Core;
using System.Web.Routing;

namespace Wicresoft.SMS.Web
{
    public class DependencyInjectFacotry
    {
        public static IConnectStringProvider CreateConnectStringProvider()
        {
            return new WebConfigProvider();
        }

        public static IUserRoleService CreateUserRoleService()
        {
            return new UserRoleService(CreateConnectStringProvider());
            //return new FackUserRoleService();
        }
    }

    public class FackUserRoleService : IUserRoleService
    {
        public string[] GetRolesForUser(string username)
        {
            string[] roles1 = { "GlobalAdmin" };
            string[] roles2 = { "GroupAdmin" };
            string[] roles3 = { "GroupUser" };
            string[] roles4 = { "Others" };
            if (username == "parkerz")
                return roles1;
            if (username == "i-pzhou")
                return roles2;
            if (username == "suek")
                return roles3;
            if (username == "leor")
                return roles4;
            else
                return null;
        }

        public bool ValidationUser(string key,string password)
        {
            return true;
        }


        public long[] GetRolesValueForUser(string username)
        {
            return new long[] { 
                (long)AuthoriseFlag.page_sms_send |
                (long)AuthoriseFlag.page_sms_template |
                (long)AuthoriseFlag.page_usermanage |
                (long)AuthoriseFlag.page_addressbook,
                (long)AuthoriseFlag.page_history,
                (long)AuthoriseFlag.edit_home_setting_displayname |
                (long)AuthoriseFlag.edit_home_setting_pwd
            };
        }

        public void LogIn(string username, bool remember)
        {
            throw new NotImplementedException();
        }


        public string GetRedirectUrl(string UserName, bool remember)
        {
            throw new NotImplementedException();
        }


        public User GetUserInfo(string key)
        {
            throw new NotImplementedException();
        }


        public void LogOut()
        {
            throw new NotImplementedException();
        }


        public string GetGetEmailByCSL(string cil)
        {
            throw new NotImplementedException();
        }

        public bool CheckEmail(string email)
        {
            throw new NotImplementedException();
        }


        public string GetMobileByCSL(string csl)
        {
            throw new NotImplementedException();
        }

        public string GetCILByCSL(string csl)
        {
            throw new NotImplementedException();
        }


        public string GetCSLByCIL(string cil)
        {
            throw new NotImplementedException();
        }

        public bool AuthUser(string username)
        {
            throw new NotImplementedException();
        }
    }
}